﻿using System.Web;
using IBll;

namespace BllFactory
{
    public class BllSessionUtil
    {
        public static IBllSession GetCurrentBllSession()
        {
            //HttpContext:一次请求，HttpContext已经保证只有一个实例
            //也可以使用一次进程一个实例
            IBllSession bllSession = HttpContext.Current.Items["currentBllSession"] as IBllSession;
            if (bllSession == null)
            {
                bllSession = new BllSession();
                HttpContext.Current.Items.Add("currentBllSession", bllSession);
            }
            return bllSession;
        }
    }
}
